{header}
<script language="JavaScript" src="js/common.js"></script>

<form action="case.php" method="get" name="form" id="form">
  <table width="100%"  border="0" cellpadding="3" cellspacing="1" class="tableOutborder">
    <tr class="tableHeader">
      <td colspan="9">案例列表</td>
    </tr>
    <tr class="bg_0">
      <td width="4%" nowrap="nowrap">案例名称</td>
      <td width="4%" nowrap="nowrap"><input name="username" type="text" id="username" value="{username}" size="20" maxlength="30" /></td>
      <td width="4%" nowrap="nowrap">添加时间</td>
      <td width="4%" nowrap="nowrap"><input name="realname" type="text" id="realname" value="{realname}" /></td>
      <td width="8%" nowrap="nowrap">添加人</td>
      <td width="8%" nowrap="nowrap"><input name="e_name" type="text" id="e_name" value="{e_name}" /></td>
      <td width="8%" nowrap="nowrap">分类</td>
      <td width="80%" nowrap="nowrap">{selecttreelist}</td>
      <td width="12%"><input name="action" type="hidden" id="action" value="view" />
          <input type="submit" name="Submit" value=" 查询 " accesskey="s" /></td>
    </tr>
  </table>
</form>
<!-- IF results -->
<table width="100%" border="0" cellspacing="1" cellpadding="3" class="pageNav">
  <tr>
    <td>共 <strong>{total}</strong>, 显示 <strong>{from} - {to}</strong></td>
    <td align="right">{pagenav}</td>
  </tr>
</table>
<table width="100%"  border="0" cellspacing="1" cellpadding="3" class="tableOutborder">
  <tr class="tableHeader">
    <td width="2%">序号</td>
    <td width="10%">案例名称</td>
    <td width="5%" align="center">排序</td>
    <td width="10%" align="center">时间</td>
    <td width="5%" align="center">操作人</td>
    <td width="5%" align="center">操作</td>
  </tr>
  <!-- BEGIN results -->
  <tr class="bg_{ROWBIT}">
    <td align="center"><input type="checkbox" name="idnames" value="{id}"></td>
    <td>{names}</td>
    <td align="center" nowrap>{sort}</td>
    <td align="center" nowrap>{add_time}</td>
    <td align="center" nowrap>{operator}</td>
    <td align="center" nowrap><a href="case.php?action=editview&id={id}">编辑</a> <a href="javascript:del({id});">删除</a></td>
  </tr>
  <!-- END -->
  <tr class="bg_1"><td colspan="5">
      全选<input type="checkbox" id="allidnames" value="" onclick="checkall()">
  </td><td align="center"><a href="javascript:delall();">批量删除</a></td></tr>
</table>
<table width="100%" border="0" cellspacing="1" cellpadding="3" class="pageNav">
  <tr>
    <td>共 <strong>{total}</strong>, 显示 <strong>{from} - {to}</strong></td>
    <td align="right">{pagenav}</td>
  </tr>
</table>
<!-- ELSE -->
<br />
没找到任何相匹配的结果!
<!-- ENDIF -->
<script type="text/javascript">
    function delall(){
        var idall=$("#allidnames").val();
        if(idall!=""){
            if(confirm("你确定删除这些记录吗\r\n该操作不可恢复!")){
                var url=iyun_interface("case")+"?do=del&id="+idall;
                ajax_request_page(url);
            }
        }else{
            alert("请选择你需要删除的记录");
        }

    }
    function del(id){
        if(confirm("你确定删除该条记录吗\r\n该操作不可恢复!")){
            if(id==""){
                alert("ID值为空");
                return false;
            }
            var url=iyun_interface("case")+"?do=del&id="+id;
            ajax_request_page(url);
        }
    }
    function ajax_request_page(url){
        $.ajax({
            url:url,
            methods:"POST",
            dataType:"json",
            success:function(data){
                //console.log(data)
                if(data.result==0){
                    alert(data.msg);
                    location.reload();
                }else{
                    alert(data.msg);
                }
            },
            error:function(){
                alert("啊哦,请求失败");
            }
        })
    }
    function checkall(){
        if($("#allidnames").attr("checked"))
        {
            checkedAll("idnames");
        }
        else {
            checkedNo("idnames");
        }
    }
</script>
{footer}
